<html>
    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <title>FFRJ.COM Admin</title>
        <style></style>
        <script language="javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
        <script type="text/javascript" language="javascript">
            $(function(){
                checkAdminStatus();
            });

            function checkAdminStatus()/*{{{*/
            {
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "get",
                    data    :   "do=loginStatus&format=json",
                    success :   function(data)
                                {
                                    displayStatus(data);
                                }
                });
            }/*}}}*/
            function displayStatus(data)/*{{{*/
            {
                var dataObject  =   eval("(" + data + ")");
                if (null == dataObject.resultData.adminUid)
                {
                    $("#login").show();
                    $(".monitor").hide();
                }
                else
                {
                    $("#login").hide();
                    $(".monitor").show();
                    $("#logout > form > div").html("<span>Administrator: </span><span>" + dataObject.resultData.nickname + "</span>");
                }
            }/*}}}*/

            function doLogin()/*{{{*/
            {
                var param   =   $("#login > form").serialize();
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param + '&format=json',
                    success :   function(data)
                                {
                                    displayStatus(data);
                                }
                });
            }/*}}}*/
            function doLogout()/*{{{*/
            {
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "get",
                    data    :   "do=adminLogout&format=json",
                    success :   function(data)
                                {
                                    displayStatus(data);
                                }
                });
            }/*}}}*/

            function doCommand(command)/*{{{*/
            {
                var param   =   $("#" + command + " > fieldset > div  > form").serialize();
                var inner   =   "#" + command + " > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/

            function doUserList()/*{{{*/
            {
                var param   =   $("#userList > fieldset > div  > form").serialize();
                var inner   =   "#userList > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/
            function doFetchUser()/*{{{*/
            {
                var param   =   $("#fetchUser > fieldset > div  > form").serialize();
                var inner   =   "#fetchUser > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/
            function doChainUser()/*{{{*/
            {
                var param   =   $("#chainUser > fieldset > div  > form").serialize();
                var inner   =   "#chainUser > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/

            function doHotSquareList()/*{{{*/
            {
                var param   =   $("#hotSquareList > fieldset > div  > form").serialize();
                var inner   =   "#hotSquareList > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/
            function doChatList()/*{{{*/
            {
                var param   =   $("#chatList > fieldset > div  > form").serialize();
                var inner   =   "#chatList > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/
            function doInformList()/*{{{*/
            {
                var param   =   $("#informList > fieldset > div  > form").serialize();
                var inner   =   "#informList > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/
            function doBoardList()/*{{{*/
            {
                var param   =   $("#boardList > fieldset > div  > form").serialize();
                var inner   =   "#boardList > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/

            function doSnsDau()/*{{{*/
            {
                var param   =   $("#snsDau > fieldset > div  > form").serialize();
                var inner   =   "#snsDau > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/


            function delAllDiary()/*{{{*/
            {
                var param   =   $("#delAllDiary  > fieldset > div  > form").serialize();
                var inner   =   "#snsDau > fieldset > table";
                $.ajax(
                {
                    url     :   "/adminApi.php",
                    type    :   "GET",
                    data    :   param,
                    success :   function(data)
                                {
                                    displayList(data, inner);
                                }
                });
            }/*}}}*/


            function displayList(data, inner)/*{{{*/
            {
                $(inner).html(data);
            }/*}}}*/

        </script>
    <head>
    <body>
        <div id="login" ><!-- {{{ -->
            <form action="adminApi.php" method="GET">
                Account:<input type="text" name="account" />
                Passwd:<input type="password" name="passwd" />
                <input type="hidden" name="do" value="adminLogin" />
                <input type="button" class="submit" value="Login" onclick="doLogin();" />
            </form>
        <hr /><br />
        </div><!-- }}} -->

        <div id="logout" class="monitor" ><!-- {{{ -->
            <form action="adminApi.php" method="POST">
                <div></div>
                <input type="hidden" name="do" value="adminLogout" />
                <input type="button" class="submit" value="Logout" onclick="doLogout();" />
            </form>
        </div>
        <hr /><br /><!-- }}} -->

        <div id="exchangeCount" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>社区换量总量统计</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getTotalExchange" />
                    <input type="button" value="Go" onclick="doCommand('exchangeCount');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->

        <div id="exchangeDailyCount" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>社区换量每日统计</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getDailyExchange" />
                    <input type="text" name="ymd" value="" />
                    <input type="button" value="Go" onclick="doCommand('exchangeDailyCount');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />

        <div id="snsDau" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>社区DAU,PV统计</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getSnsDau" />
                    <input type="text" name="ymd" value="" />
                    <input type="button" value="Go" onclick="doCommand('snsDau');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->

        <div id="snsQuarter" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>PV /小时</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getSnsQuarter" />
                    <input type="text" name="ymd" value="" />
                    <select name="type" >
                        <option value="times">PV 总数</option>
                        <option value="chats">聊天记录数</option>
                        <option value="cloudSync">同步记录数</option>
                        <option value="comments">评论记录数</option>
                        <option value="diarys">分享日记数</option>
                        <option value="follows">关注人次数</option>
                        <option value="likes">喜欢日记数</option>
                        <option value="messages">私心发信数</option>
                        <option value="registers">粉粉账户注册请求数</option>
                    </select>
                    <input type="button" value="Go" onclick="doCommand('snsQuarter');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />

        <div id="userList" class="monitor" ><!-- {{{ -->
        <fieldset><legend>用户列表</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getUserList" />
                    起始位置:<input type="text" name="start" value="0" />
                    请求数量:<input type="text" name="length" value="20" />
                    设备 SN :<input type="text" name="deviceSN" value="" />
                    正常用户:<input type="radio" name="status" value="0" />
                    禁言用户:<input type="radio" name="status" value="1" />
                    <!-- input type="button" value="Go" onclick="doUserList();" /-->
                    <input type="button" value="Go" onclick="doCommand('userList');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />

        <div id="userStatistics" class="monitor" ><!-- {{{ -->
        <fieldset><legend>用户统计信息</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getUserStatistics" />
                    用户UID :<input type="text" name="uid" value="" />
                    查询:<input type="radio" name="status" checked value="0" />
                    更新:<input type="radio" name="status" value="1" />
                    <input type="button" value="Go" onclick="doCommand('userStatistics');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />

        <div id="removeCloudSync" class="monitor" ><!-- {{{ -->
        <fieldset><legend>删除用户同步信息</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="cloudRemoveByUid" />
                    用户UID :<input type="text" name="uid" value="" />
                    <input type="button" value="Go" onclick="doCommand('removeCloudSync');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />
        
		<div id="regainCloudSync" class="monitor" ><!-- {{{ -->
        <fieldset><legend>恢复用户同步信息</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="regainCloudSync" />
                    用户UID :<input type="text" name="uid" value="" />
                    <input type="button" value="Go" onclick="doCommand('regainCloudSync');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />
        
        <div id="fetchUser" class="monitor" ><!-- {{{ -->
        <fieldset><legend>用户查找</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="fetchUserInfo" />
                    <p><span>注：用户账号、昵称、邮件的搜索方式5种，1. string(全字匹配)；2. string%(前缀匹配); 3. string%string(前缀,后缀); 4. %string(后缀匹配); 5. %string%(全文搜索)， 性能从高到低，慎用！</span></p>
                    起始位置:<input type="text" name="start" value="0" />
                    请求数量:<input type="text" name="length" value="20" />
                    用户UID :<input type="text" name="uid" value="" />
                    设备 SN :<input type="text" name="deviceSN" value="" />
                    用户账号:<input type="text" name="account" value="" />
                    用户昵称:<input type="text" name="nickname" value="" />
                    用户邮件:<input type="text" name="email" value="" />
                    <input type="button" value="Go" onclick="doCommand('fetchUser');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />

        <div id="modifyUserPasswd" class="monitor" ><!-- {{{ -->
        <fieldset><legend>修改密码</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="modifyUserPasswd" />
                    <p><span>用户Uid、账户、邮件 3者至少选择输入一个，为了确认信息，建议使用上面的接口先行查询再确定，新密码必填字段</span></p>
                    用户UID :<input type="text" name="uid" value="" />
                    用户账号:<input type="text" name="account" value="" />
                    用户邮件:<input type="text" name="email" value="" />
                    用户密码:<input type="text" name="passwd" value="" />
                    <input type="button" value="Go" onclick="doCommand('modifyUserPasswd');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />

        <div id="chainUser" class="monitor" ><!-- {{{ -->
        <fieldset><legend>用户禁言</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="chainUser" />
                    用户UID:<input type="text" name="uid" value="" />
                    用户解封:<input type="radio" name="status" value="0" />
                    用户禁言:<input type="radio" name="status" value="1" checked />
                    封停设备:<input type="checkbox" name="forbidDevice" value="1" checked />
                    <input type="button" value="Go" onclick="doCommand('chainUser');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />

        <div id="removeSquare" class="monitor" ><!-- {{{ -->
        <fieldset><legend>删除广场</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="removeSquare" />
                    广场 ID:<input type="text" name="id" value="" />
                    用户UID:<input type="text" name="uid" value="" />
                    <input type="button" value="Go" onclick="doCommand('removeSquare');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
        <br /><hr />


        <br /><hr />

        <div id="delAllDiary" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>社日记删除</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="delAllDiary" />
                    <input type="text" name="uid" value="" />
                    <input type="button" value="Go" onclick="doCommand('delAllDiary');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
        </div><!-- }}} -->
		<br /><hr />
		<div id="removeManyComment" class="monitor"><!-- {{{ -->
		<fieldset ><legend>评论删除</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="removeManyComment" />
                     <p><span>注：三个选项都必须填,1.发帖人的uid；2需要删除评论的uid；3.帖子的bodyid；</span></p>
                                 帖子用户UID：<input type="text" name="uid" value=" " />
                             删除的用户UID：<input type="text" name="cUid" value=" " />
                         帖子的bodyid：<input type="text" name="bodyId" value=" " />
                    <input type="button" value="Go" onclick="doCommand('removeManyComment');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset>
		</div><!-- }}} -->
        <div id="hotSquareList" class="monitor" ><!-- {{{ -->
        <br /><hr />
        <fieldset ><legend>搜索分享的日记(hotSquareList)</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="fetchDiaryInfo" />
                    <p><span>注：用户UID、昵称、标题的搜索方式5种，1. string(全字匹配)；2. string%(前缀匹配); 3. string%string(前缀,后缀); 4. %string(后缀匹配); 5. %string%(全文搜索)， 性能从高到低，慎用！</span></p>
                    起始位置:<input type="text" name="start" value="0" />
                    请求数量:<input type="text" name="length" value="21" />
                    最小ID  :<input type="text" name="id" value="" />
                    用户UID :<input type="text" name="uid" value="" />
                    用户昵称:<input type="text" name="nickname" value="" />
                    日记标题:<input type="text" name="title" value="" />
                    <input type="button" value="Go" onclick="doCommand('hotSquareList');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset><hr /><br />
        </div><!-- }}} -->
        <br /><hr />
        
        <div id="chatList" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>聊天室列表</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getChatList" />
                    起始位置:<input type="text" name="start" value="0" />
                    请求数量:<input type="text" name="length" value="20" />
                    用户UID :<input type="text" name="uid" value="" />
                    最小ID  :<input type="text" name="id" value="" />
                    <input type="button" value="Go" onclick="doCommand('chatList');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset><hr /><br />
        </div><!-- }}} -->
        <br /><hr />
        
        <div id="informList" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>举报列表</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getInformList" />
                    起始位置:<input type="text" name="start" value="0" />
                    请求数量:<input type="text" name="length" value="20" />
                    <input type="button" value="Go" onclick="doCommand('informList');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset><hr /><br />
        </div><!-- }}} -->
        <br /><hr />
        
        <div id="boardList" class="monitor" ><!-- {{{ -->
        <fieldset ><legend>公告列表</legend>
            <div>
                <form action="adminApi.php" method="POST">
                    <input type="hidden" name="do" value="getBoardList" />
                    起始位置:<input type="text" name="start" value="0" />
                    请求数量:<input type="text" name="length" value="20" />
                    <input type="button" value="Go" onclick="doCommand('boardList');" />
                </form>
            </div>
            <table>
            </table>
        </fieldset><hr /><br />
        </div><!-- }}} -->
        <br /><hr />

        <!--div class="monitor" >
        <fieldset ><legend>AdminList</legend>
        </fieldset><hr /><br />
        </div>

        <div class="monitor" >
        <fieldset ><legend>UserInfo</legend>
        </fieldset><hr /><br />
        </div>

        <div class="monitor" >
        <fieldset ><legend>DiaryInfo</legend>
        </fieldset><hr /><br />
        </div>

        <div class="monitor" >
        <fieldset ><legend></legend>
        </fieldset><hr /><br />
        </div-->
    </body>
</html>
